const parseRoute = (authRoutes: any) => {
    if (authRoutes) {
        return authRoutes.map((item: any) => ({
            path: item.path,
            name: item.categoryIndex,
            icon: item.icons,
            authority: item.authority ? item.authority.split(',') : null,
            component: item.component,
            //component: dynamic({ component: () => import('./pages'+item.path )}) ,            
            routes: item.children ? parseRoute(item.children) : item.children
        }))
    }
    return [];
}
export function patchRoutes(routes: any) {
    fetch('/api/services/app/Category/GetTreeListAsync?layout=Menu', {
        method: 'GET',
    }).then((response: any) => {
        if (response) {
            var menus = parseRoute(response.result);
            menus.forEach((item: any) => routes.routes[0].routes[1].routes.push(item))
            //console.log("patchRoutes", routes);
        }
    });
}
export function render(oldRoutes: any) {
    oldRoutes();
}